import request from '@/utils/request'
import qs from 'qs'

// 素材列表
export function getMaterials(params) {
  return request({
    url: '/material/findList',
    method: 'post',
    params
  })
}

// 添加素材
export function addMaterial(data) {
  const postData = qs.stringify(data)
  return request({
    url: '/material/add',
    method: 'post',
    data: postData
  })
}

// 编辑素材
export function updateMaterial(data) {
  const postData = qs.stringify(data)
  return request({
    url: '/material/update',
    method: 'post',
    data: postData
  })
}

// 批量删除素材
export function removeMaterials(params) {
  return request({
    url: '/material/delete',
    method: 'post',
    params
  })
}

// 复制素材
export function copyMaterial(params) {
  return request({
    url: '/material/copy',
    method: 'post',
    params
  })
}

// 批量同步素材
export function syncMaterials(params) {
  return request({
    url: '/material/sync',
    method: 'post',
    params
  })
}

// 批量同步微信素材
export function syncWxMaterials(params) {
  return request({
    url: '/material/updateWeChatMaterial',
    method: 'get',
    params
  })
}

// 批量上下线素材
export function onlineMaterials(params) {
  return request({
    url: '/material/online',
    method: 'post',
    params
  })
}

// 保存素材
export function saveMaterial(params) {
  return request({
    url: '/material/save',
    method: 'post',
    params
  })
}

// 查询已同步微信上线素材
export function getWechatMaterials(params) {
  return request({
    url: '/material/findSync',
    method: 'get',
    params
  })
}
